<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MvcCms.Web.ViewModels.BackOfficeModel>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    MvcCms - <%=ViewData["PageTitle"]%>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeaderContent" runat="server">
    <style type="text/css">
        .style1
        {
            color: #FF3300;
            font-weight: bold;
            font-size: large;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="contentpage-outerdiv">
        <span class="field-validation-error">&nbsp;<%= Html.ValidationSummary("Edit was unsuccessful. Please correct the errors and try again.") %>
            <%=ViewData["message"].ToString()%>
        </span>
        <% using (Html.BeginForm("EditPortal", "BackOffice", FormMethod.Post, new { id = "form1" }))
           {%>
        <fieldset>
            <legend>Edit Portal</legend>
            <div>
                <table width="100%">
                    <tr>
                        <td width="70%">
                            <p>
                                <label for="Title">
                                    Name:</label>
                                <%if (Model._Portal.Name == "Default")
                                  {%>
                                <%=Html.Encode(Model._Portal.Name) %>
                                <%}
                                  else
                                  { %>
                                <%= Html.TextBox("Name", Model._Portal.Name, new { @class = "required" })%>
                                <%} %>
                                <%= Html.ValidationMessage("Name", "")%>
                            </p>
                            <p>
                                <label for="Title">
                                    Display Name:</label>
                                <%= Html.TextBox("DisplayName", Model._Portal.DisplayName, new { @class = "required" })%>
                                <%= Html.ValidationMessage("DisplayName", "")%>
                            </p>
                            <p>
                                <label for="Title">
                                    Skin Name:</label>
                                <%= Html.TextBox("SkinName", Model._Portal.SkinName, new { @class = "required" })%>
                                <%= Html.ValidationMessage("SkinName", "")%>
                            </p>
                            <p>
                                <label for="Title">
                                    Url Authority:</label>
                                <%= Html.TextBox("URLAuthority", Model._Portal.URLAuthority, new { @class = "required" })%>
                                <%= Html.ValidationMessage("URLAuthority", "")%>
                            </p>
                            <p>
                                <label for="AdminEmail">
                                    Admin Email:</label>
                                <%= Html.TextBox("AdminEmail", Model._Portal.AdminEmail, new { @class = "required" })%>
                                <%= Html.ValidationMessage("AdminEmail", "")%>
                            </p>
                            <p>
                                <label for="UseFullText">
                                    Use Full Text:</label>
                                <%= Html.CheckBox("UseFullText", Model._Portal.UseFullText)%>
                                <%= Html.ValidationMessage("UseFullText", "")%>
                            </p>
                            <p>
                                <label for="Title">
                                    Timezone Offset:</label>
                                <%= Html.TextBox("TimezoneOffset", Model._Portal.TimezoneOffset)%>
                                <%= Html.ValidationMessage("TimezoneOffset", "")%>
                            </p>
                            <p>
                                <label for="Title">
                                    Uses Razor Theme:</label>
                                <%= Html.CheckBox("IsRazor", Model._Portal.IsRazor)%>
                            </p>
                            <p>
                                <label for="Title">
                                    Uses Wiki For CMS:</label>
                                <%= Html.CheckBox("UsesWikiForCMS", Model._Portal.UsesWikiForCMS)%>
                                <%= Html.ValidationMessage("UsesWikiForCMS", "")%>
                            </p>
                            <p>
                                <label for="Title">
                                    Allow Page Wiki Html Switch:</label>
                                <%= Html.CheckBox("AllowPageWikiHtmlSwitch", Model._Portal.AllowPageWikiHtmlSwitch)%>
                                <%= Html.ValidationMessage("AllowPageWikiHtmlSwitch", "")%>
                            </p>
                            <p>
                                <label for="Title">
                                    Allow OpenId Registration:</label>
                                <%= Html.CheckBox("AllowOpenIdRegistration", Model._Portal.AllowOpenIdRegistration)%>
                                <%= Html.ValidationMessage("AllowOpenIdRegistration", "")%>
                            </p>
                            <p>
                                <%=Html.Hidden("PortalID", Model._Portal.PortalID)%>
                                <input type="submit" value="Save" />
                            </p>
                        </td>
                    </tr>
                </table>
            </div>
        </fieldset>
        <% } %>
        <div>
            <table width="100%" border="0" cellpadding="0" cellspacing="0" class="data-table">
                <tr>
                    <th>
                        Portal Resoources
                    </th>
                </tr>
                <% 
                    foreach (var item in Model._PortalResourceTypes)
                    { %>
                <tr>
                    <td>
                        <a href="/backoffice/EditPortalResource/<%= Html.Encode(item.PortalResourceTypeID) %>/<%= Html.Encode(Model._Portal.PortalID) %>">
                            <%= Html.Encode(item.Name) %></a>
                    </td>
                </tr>
                <% } %>
            </table>
        </div>
        <div>
            <%=Html.ActionLink("Back to List", "ManagePortals") %>
        </div>
    </div>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ScriptContent" runat="server">
    <script src="../../Scripts/jquery.validate.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $("#form1").validate({
            submitHandler: function(form) {
                form.submit();
            }
        });
        
    
    
    </script>
</asp:Content>
